package collectionDemo;

import java.util.ArrayDeque;
import java.util.Collection;
import java.util.Iterator;
import java.util.Queue;

/**
 *@Author:fengxiaohui
 *@Description:
 *@Date:Create in 22:25 2025/1/5
 *@Modified By:
 */
public class QueueDemo {

    static class User{
        private String name;
        private Integer age;
        private String city;

        public User(String name,Integer age,String city){
            this.name = name;
            this.age = age;
            this.city = city;
        }
        public User(String name){
            this.name = name;
        }
    }

    public static void main(String[] args) {
        //数据准备
        Long beiginTime = System.currentTimeMillis();
        System.out.println(beiginTime);
        User user1 = new User("lisi1",12,"beijing");
        User user2 = new User("lisi2",13,"beijing");
        User user3 = new User("lisi3",14,"beijing");
        User user4 = new User("lisi4",15,"beijing");
        User user5 = new User("lisi5",16,"beijing");
        Long middleTime = System.currentTimeMillis();
        System.out.println(middleTime - beiginTime);
        //队列初始化
        Queue<User> quere = new ArrayDeque<>();
        if(quere.size() != 0){
            quere.clear();
            System.out.println("queue初始化 OK" + quere.size());
        }
        quere.add(user1);
        quere.add(user2);
        quere.add(user3);
        quere.add(user4);
        quere.add(user5);
        Long endTime = System.currentTimeMillis();
        System.out.println(endTime - beiginTime);
        System.out.println("数据构造完成 " + quere.size());

        try{
            String queueId = null;
            System.out.println(queueId.length());

        }catch (NullPointerException npe){
            System.out.println("Caught NullPointerException: " + npe.getMessage());
        }finally {
            System.out.println("释放资源");
        }


    }

}
